<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>扩大可点击区域</title>
    <link rel="stylesheet" href="../public.css">
    <style>
        .box{
            position:relative;
            width:50px;
            height:50px;
            margin:20px auto;
            text-align: center;
            line-height: 50px;
            color: white;
            font-weight: bold;
            border-radius: 50%;
            background-color: yellowgreen;
        }
        .back{
            border: 10px transparent solid;
            background-clip: padding-box;
        }
        .back:hover{
            box-shadow: 0 0 .3em red;
        }
        .back1{
            border: 10px transparent solid;
            background-clip: padding-box;
            box-shadow: 0 0 2px rgba(0,0,0.3) inset;
        }
        .back1:hover{
            box-shadow: 0 0 2px red;
        }
        .back2::before{
            content:'';
            position: absolute;
            top: -10px;
            bottom:-10px;
            left: -10px;
            right: -10px;
        }
        .back2:hover{
            box-shadow: 0 0 4px red;
        }
    </style>
</head>

<body>
    <div class="content">
        <h1></h1>
        <ul>
            <li>通过设置border设置为透明色，来扩大点击范围</li>
            <li>通过box-shadow模拟盒子边框</li>
            <li>但是边框会影响布局</li>
        </ul>
        <div class="box back">
            点击
        </div>
        <div class="box back1">
            点击
        </div>
        <ul>
            <li>伪元素同样可以代表其宿主元素来响应鼠标交互</li>
            <li>在按钮上覆盖一层透明的伪元素</li>
            <li>基于伪元素的解决方案，可以把点击范围设置为任何尺寸，形状、位置，甚至可以脱离元素原有的位置</li>
        </ul>
        <div class="box back2">
            点击
        </div>
    </div>
</body>

</html>